

/*---------------------------------------------------------
   Initializes the effect. The data is a table of data 
   which was passed from the server.
---------------------------------------------------------*/
function EFFECT:Init( data )
	
	self.Position = data:GetStart()
	self.WeaponEnt = data:GetEntity()
	self.Attachment = data:GetAttachment()
	
	// Keep the start and end pos - we're going to interpolate between them
	local Pos = self:GetTracerShootPos( self.Position, self.WeaponEnt, self.Attachment )
	
	local Velocity 	= data:GetNormal()
	local myType=math.Round(math.Rand(0,1))
	if myType==1 then
		Velocity.x = math.Rand(-3,3)
		Velocity.y = math.Rand(-3,3)
		Velocity.z = math.Rand(-4,-2)
	end
	
	Pos = Pos + data:GetNormal() * 8
	
	local LightColor = render.GetLightColor( Pos ) * 255
	local Greenness = math.Rand(8,32)
	LightColor.r = math.Clamp( LightColor.r+math.Rand(-64,64)+(Greenness*0.6), 0, 255 )
	LightColor.g = math.Clamp( LightColor.g+(Greenness*0.3), 0, 128 )
	LightColor.b = math.Clamp( LightColor.b+(Greenness*0.1), 0, 64 )
	LightColor.r = (LightColor.r + 64) / 2
	LightColor.g = (LightColor.g + 64) / 2
	LightColor.b = (LightColor.b + 64) / 2
	
	local emitter = ParticleEmitter( Pos )
	if (myType==0) then
		local particle = emitter:Add( "effects/blood_core", Pos )
			particle:SetVelocity( Velocity * math.Rand( 1, 10 ) )
			particle:SetDieTime( math.Rand( 0.5 , 2 ) )
			particle:SetStartAlpha( 100 )
			particle:SetStartSize( math.Rand( 4, 12 ) )
			particle:SetEndSize( math.Rand( 20, 32 ) )
			particle:SetRoll( math.Rand( -180, 180 ) )
			//particle:SetRollDelta( math.Rand( -1, 1 ) )
			particle:SetColor( LightColor.r, LightColor.g, LightColor.b )	
		emitter:Finish()
	end
	if (myType==1) then
		local particle = emitter:Add( "particles/smokey", Pos )
			particle:SetVelocity( Velocity * math.Rand( 1, 10 ) )
			particle:SetDieTime( math.Rand( 0.5 , 2 ) )
			particle:SetStartAlpha( 100 )
			particle:SetStartSize( math.Rand( 2, 4 ) )
			particle:SetEndSize( math.Rand( 18, 26 ) )
			particle:SetRoll( math.Rand( -50, 50 ) )
			particle:SetRollDelta( math.Rand( -1, 1 ) )
			particle:SetColor( LightColor.r, LightColor.g, LightColor.b )	
		emitter:Finish()
	end
	
end


/*---------------------------------------------------------
   THINK
   Returning false makes the entity die
---------------------------------------------------------*/
function EFFECT:Think( )

	// Die instantly
	return false
	
end


/*---------------------------------------------------------
   Draw the effect
---------------------------------------------------------*/
function EFFECT:Render()

	// Do nothing - this effect is only used to spawn the particles in Init
	
end



